﻿using CoreProject.IRepository;
using CoreProject.Model;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace CoreProject.Repository
{
    public class HJQ_salesRepository : BaseRepository<HjqSalesReport>, IHJQ_salesRepository
    {
        private readonly EFDbContext AA;

        public HJQ_salesRepository(EFDbContext context) : base(context)
        {
           AA = context;
        }

        public async Task<(List<HjqSalesReport> list, int count)> AAAPage<Type>(int page, int limit, bool ISA, Expression<Func<HjqSalesReport, Type>> orderladba, Expression<Func<HjqSalesReport, bool>> whereladb)
        {
            var AX =  AA.Set<HjqSalesReport>().Where(whereladb).AsQueryable();

            int count = AX.Count();
            var AAA = await AX.OrderBy(orderladba).Skip((page - 1) * limit).Take(limit).ToListAsync();
            return (AAA, count);
        }
    }
}
